package com.fastjpa.entity;
import javax.persistence.*;
import lombok.Getter;
import lombok.Setter;
import java.lang.Long;
import java.lang.String;
import com.fastjpa.entity.Teacher;
import java.util.List;
import com.efeichong.audit.InsertDefault;
import lombok.ToString;

/**
* @author admin
* @date 2022/07/17
* @description 班级
*/
@Setter
@Getter
@Entity(name = "clazz")
@Table(indexes = {
		@Index(name = "PRIMARY", columnList = "id", unique = true),
})
public class Clazz {
    /**id**/
    @Column(name = "[id]", columnDefinition = "bigint comment 'id'")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**班级名称**/
    @Column(name = "[name]", columnDefinition = "varchar (50) comment '班级名称'")
    private String name;

    /**租户id**/
    @Column(name = "[tenant_id]", columnDefinition = "varchar (20) comment '租户id'")
    private String tenantId;

    @JoinTable(name = "clazz_teacher_ship",
			joinColumns = @JoinColumn(name = "clazz_id", referencedColumnName = "id"),
			inverseJoinColumns = @JoinColumn(name = "teacher_id", referencedColumnName = "id"))
    @ManyToMany(fetch = FetchType.LAZY)
    private List<Teacher> teachers;

    @OneToMany(fetch = FetchType.LAZY,mappedBy = "clazz")
    private List<Student> students;


}
